<html>
<script type="text/javascript">
function selectOne(){
	var index = document.getElementById("selectArg").selectedIndex
	var opt = document.getElementById("selectArg").options[index].value
	document.getElementById("paramName").value = opt
	document.getElementById("paramValue").value = document.getElementById("argValue").value
	document.getElementById("myForm").submit()
}
function showModelPage(obj,span){
	var childs = obj.childNodes;
	var route = childs[3].innerHTML;
	var argName = childs[5].getAttribute("data-text");
	var date = childs[7].innerHTML;
	var modelType = span.getAttribute("modelType")
	data = "?target="+argName+"&paramPath="+route+"&date="+date+"&modelType="+modelType;
	window.location.href = "/myDetector/showModels/"+data;
	
}
</script>
<style type="text/css">
th,td{text-align:center;font-size:10;border: 1px solid;}
table{border:1px solid;border-collapse:collapse;}
}
</style>
<body>
	<div name="title" style="margin: 0 auto;width:400px;height:100px;">
		<h2  style="width: 300px;height: 90px;margin-left: auto;margin-right: auto;text-align: center;line-height: 70px;">
			统计学习方法检测异常参数
		</h2>
	</div>
	<div name="inputZone" style="margin: 0 auto;width:600px;height:50px;">
		<form id="myForm" action="{% url 'myDetector:mainDealer'%}" method="post" style="width: 500px;height: 60px;margin: 0 auto;padding: 10px;">
			{% csrf_token %}
			<select id="selectArg" name="chooseArg" width="80px" style="margin: 0 auto;width: 230px;">
				{% if ArgsList %}
					{% for arg in ArgsList %}
						<option value="{{arg.route}}?{{arg.arg_name}}">{{arg.route}}/{{arg.arg_name}}</option>
					{% endfor%}
				{% endif %}
			</select>
			<input name="argValue" id="argValue" type="text"  width="120px"; style="margin: 0 auto;">
			<input name="submit" id="submitBtn" value="提交" onClick=selectOne() type="submit" width="20px" style="margin: 0 auto;">
			<input name="paramName" type="hidden" id="paramName" value="default">
			<input name="paramValue" type="hidden" id="paramValue" value="default">
			<input name="rawTarget" type="hidden" id="paramValue" value="myDefensor:argShow">

		</form>
	</div>
	<div name="rst" style="margin: 0 auto;width:400px;height:30px;">
		<p style="margin: 0 auto;width: 400px;height: 20px;text-align: center;color: red;">{{rst}}</p>
	</div>
	<table style="width: 950px;margin: 0 auto;">
		<tr>
			<th>id</th>
			<th>路径</th>
			<th>参数名</th>
			<th>提交日期</th>
			<th>来源IP</th>
			<th>长度</th>
			<th>类型</th>
			<th>提交值</th>
		</tr>
		{% if submitData %}
			{% for data in submitData%}
			<tr style="{{data.style}}">
				<td>{{data.id}}</td>
				<td>{{data.route}}</td>
				<td id="{{ data.id }}" data-text="{{data.arg_name}}">{{data.arg_name}}<span modelType="cm" onClick=showModelPage(this.parentNode.parentNode,this)> (cm</span>/<span modelType="lm" onClick=showModelPage(this.parentNode.parentNode,this)>lm)</span></td>
				<td>{{data.add_date|date:'Ymd'}}</td>
				<td>{{data.source_ip}}</td>
				<td>{{data.value_len}}</td>
				<td>{{data.type_judgement}}</td>
				<td>{{data.value}}</td>
			</tr>
			{% endfor %}
		{% endif %}
	</table>
		

</body>
</html>